<%@page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/sectionparent.css" source="widget" />
<link type="text/css" rel="stylesheet"
	href="${ctx }/css/dlifestyle/admin.css" source="widget" />
<script
	src="${ctx}/js/controllers/base/cellhouse/CellHouseEditController.js"
	type="text/javascript"></script>
<style>
select {
	padding-left: 8px;
	font-size: 12px;
	border-radius: 10px;
	background-image: none;
	margin-top: 4px;
	width: 120px;
	border: 1px solid #CBD5DD;
	color: #8b8787;
	font-family: "微软雅黑";
}
</style>
<section>
	<div style="height: 40px; line-height: 40px;">
		<div class="forword_area"></div>
		<div class="location">当前位置：${sessionScope.currcent_position}</div>
	</div>
	<hr>
	<div class="panel panel-default">
		<div class="editTitle">
			<div style="height: 41px; width: 190px; float: left;">
				<img style="float: left; margin-left: 37px; margin-top: 9.5px;"
					src="${ctx}/images/new_edit.png" />
				<c:if test="${type == 1 }">
					<h4>新增房屋信息</h4>
				</c:if>
				<c:if test="${type == 2 }">
					<h4>编辑房屋信息</h4>
				</c:if>
			</div>
			<div>
				<a style="float: right; margin-right: 20px; margin-top: -2px;"
					title="关闭" onclick="cancel();"><img
					src="${ctx}/images/new_close.png" /></a>
			</div>
		</div>
		<div id="form" class="form" style="min-height: 350px;">
			<div class="itemEdit">
				<input id="houseId" type="hidden" value="${cellHouse.id }">
				<span class="col-sm-1 editlableEdit">房屋名称：</span>
				<div class="flEdit">
					<input class="controlEdit" onblur="checkName();" id="name"
						value="${cellHouse.name }" type="text" class="text" maxlength="20"
						placeholder="请输入房屋名称（最多20字）" /> <em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">区域：</span>
				<div class="flEdit">
					<input id="cellid" class="editform-control" style="padding-left: 9px;height:30px;width:120px;" type="text" value="${sessionScope.user_login.currentCell.cellName}" readonly="readonly">
					<select id="cellRegionId" onblur="checkCellRegion();"
						style="height: 30px;">
						<option value="">--区域--</option>
						<c:if test="${not empty cellRegions}">
							<c:forEach items="${cellRegions}" var="cellRegion"
								varStatus="status">
								<c:if test="${cellRegion.name == cellHouse.regionName}">
									<option id="${cellRegion.name}" value="${cellRegion.id}"
										selected>${cellRegion.name}</option>
								</c:if>
								<c:if test="${cellRegion.name != cellHouse.regionName}">
									<option id="${cellRegion.name}" value="${cellRegion.id}">
										${cellRegion.name}</option>
								</c:if>
							</c:forEach>
						</c:if>
					</select>
					<input id="buildingId" type="hidden" value="${cellHouse.buildingId}">
					<select id="cellBuildingId" onblur="checkCellBuilding();"
						style="height: 30px;">
						<option value="">--楼栋--</option>
						<c:if test="${not empty cellBuildings}">
							<c:forEach items="${cellBuildings}" var="cellBuilding"
								varStatus="status">
								<c:if
									test="${cellBuilding.buildingName == cellHouse.buildingName}">
									<option id="${cellBuilding.buildingName}"
										value="${cellBuilding.id}" selected>
										${cellBuilding.buildingName}</option>
								</c:if>
								<c:if
									test="${cellBuilding.buildingName != cellHouse.buildingName}">
									<option id="${cellBuilding.buildingName}"
										value="${cellBuildings.id}">
										${cellBuilding.buildingName}</option>
								</c:if>
							</c:forEach>
						</c:if>
					</select>
					<input id="unitId" type="hidden" value="${cellHouse.unitId}">
					<select id="cellUnitId" onblur="checkCellUnit();"
						style="height: 30px;">
						<option value="">--单元--</option>
						<c:if test="${not empty cellUnits}">
							<c:forEach items="${cellUnits}" var="cellUnit" varStatus="status">
								<c:if test="${cellUnit.name == cellHouse.unitName}">
									<option id="${cellUnit.name}" value="${cellUnit.id}" selected>
										${cellUnit.name}</option>
								</c:if>
								<c:if test="${cellUnit.name != cellHouse.unitName}">
									<option id="${cellUnit.name}" value="${cellUnit.id}">
										${cellUnit.name}</option>
								</c:if>
							</c:forEach>
						</c:if>
					</select>
					<em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">房屋类型：</span>
				<div class="flEdit">
					<select id="houseType" onblur="checkHouseType();"
						style="height: 31px; width: 130px;">
						<option value="">--全部类型--</option>
						<c:forEach items="${houseTypes}" var="house" varStatus="status">
							<c:if test="${house.value == cellHouse.houseType}">
								<option id="${house.value}" value="${house.value}" selected>
									${house.label}</option>
							</c:if>
							<c:if test="${house.value != cellHouse.houseType}">
								<option id="${house.value}" value="${house.value}">
									${house.label}</option>
							</c:if>
						</c:forEach>
					</select> <em class="emStyle">*</em>
				</div>
			</div>
			<div class="itemEdit">
				<span class="col-sm-1 editlableEdit">房屋状态：</span>
				<div class="flEdit">
					<select id="houseState" onblur="checkHouseState();"
						style="height: 31px; width: 130px;">
						<option value="">--全部状态--</option>
						<c:forEach items="${houseStates}" var="state" varStatus="status">
							<c:if test="${state.value == cellHouse.houseState}">
								<option id="${state.value}" value="${state.value}" selected>
									${state.label}</option>
							</c:if>
							<c:if test="${state.value != cellHouse.houseState}">
								<option id="${state.value}" value="${state.value}">
									${state.label}</option>
							</c:if>
						</c:forEach>
					</select> <em class="emStyle">*</em>
				</div>
			</div>
			<div>

				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">面积：</span>
					<div class="flEdit">
						<input class="controlEdit" style="width: 120px;"
							onblur="checkArea();" id="area" type="text" maxlength="10"
							value="${cellHouse.area}" placeholder="请输入房屋面积"> <span
							style="font-size: 12px">(㎡)</span>
					</div>
				</div>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">物业费单价：</span>
					<div class="flEdit">
						<input class="controlEdit" style="width: 120px;"
							onblur="checkPerPrice();" id="perPrice" type="text"
							maxlength="10" value="${cellHouse.perPrice}"
							placeholder="请输入物业费单价"> <span style="font-size: 12px">(元)</span>
					</div>
				</div>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">户主1：</span>
					<div class="flEdit">
						<input class="controlEdit" 
							id="ownerName1" type="text"
							maxlength="15" value="${cellHouse.ownerName1}"
							placeholder="请输入户主名（最多15字）">
					</div>
				</div>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">户主1电话：</span>
					<div class="flEdit">
						<input class="controlEdit" style="width: 150px;"
							onblur="checkPhone();" id="ownerPhone1" type="text"
							value="${cellHouse.ownerPhone1}"
							placeholder="请输入户主电话">
					</div>
				</div>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">户主2：</span>
					<div class="flEdit">
						<input class="controlEdit" id="ownerName2"
							type="text" maxlength="15" value="${cellHouse.ownerName2}"
							placeholder="请输入另一个户主名（最多15字）">
					</div>
				</div>
				<div class="itemEdit">
					<span class="col-sm-1 editlableEdit">户主2电话：</span>
					<div class="flEdit">
						<input class="controlEdit" style="width: 150px;"
							onblur="checkPhone1();" id="ownerPhone2" type="text"
							value="${cellHouse.ownerPhone2}"
							placeholder="请输入另一个户主电话">
					</div>
				</div>
				<%-- <div class="itemEdit">
					<span class="col-sm-1 editlableEdit">排序：</span>
					<div class="flEdit">
						<input class="sortEdit" id="sort" type="number" maxlength="11"
							value="${cellHouse.sort == null ? 1 : cellHouse.sort}"> <em
							class="emStyle">*</em>
					</div>
				</div> --%>

				<div class="foot">
					<button class="buttonCancle" onclick="cancel();">取&nbsp;&nbsp;消</button>
					<button class="buttonEdit" onclick="saveCellHouse();">保&nbsp;&nbsp;存</button>
				</div>
			</div>
		</div>
		<%@include file="/views/common/footer.jsp"%>
	</div>
</section>
<script type="text/javascript">
	var ctx = '${ctx}';
	setCtx(ctx);
</script>
<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
